import org.junit.Test;

public class testThread {
    @Test
    public void runAndStart() {
        cxThread01 cx = new cxThread01();
        Thread thread = new Thread(cx, " cxThread!!!");
        thread.start();
        cxThread cx1 = new cxThread();
        cx1.start();
        while (true) {
            System.out.println("main thread running");
        }
    }

    @Test
    public void penThread() {
        Pen pen = new Pen();
        new Thread(pen, "张三").start();
        new Thread(pen, "李四").start();
        new Thread(pen, "王五").start();
    }

    @Test
    public void pen1Thread() {
        Pen1 pen = new Pen1();
        new Thread(pen, "张三").start();
        new Thread(pen, "李四").start();
        new Thread(pen, "王五").start();
    }

    @Test
    public void pen2Thread() {
        Pen2 pen = new Pen2();
        new Thread(pen, "张三").start();
        new Thread(pen, "李四").start();
        new Thread(pen, "王五").start();
    }

    @Test
    public void minAndMaxThread() {
        Thread MaxThread = new Thread(new maxThread());
        Thread MinThread = new Thread(new minThread());
        MaxThread.setPriority(10);
        MinThread.setPriority(1);
        MinThread.start();
        MaxThread.start();
    }

    @Test
    /*生产者消费者问题*/
    public void customerThread() {
        Goods goods = new Goods();
        goods.setGoods(5);
        new customer(goods).start();
        new Merchants(goods).start();
    }
}
